/**
 * @author 陈泰来
 * @version V1.0
 * @Project echo-java-base
 * @Title 红头鸭
 * @Description 实现叫声接口
 * @Package designmodel.composite
 * @date 2021/3/2 4:06 下午
 * @Copyright:学如逆水行舟，不进则退 .
 */
package designmodel.composite;

import designmodel.composite.observer.Observable;
import designmodel.composite.observer.Observer;

public class RedheadDuck implements Quackable {

    Observable observable;

    public RedheadDuck() {
        observable = new Observable(this);
    }

    @Override
    public void quack() {
        System.out.println("Quack");
        notifyObservers();
    }


    @Override
    public void registerObserver(Observer observer) {
        observable.registerObserver(observer);
    }

    @Override
    public void notifyObservers() {
        observable.notifyObservers();
    }
}

